import request from '@/router/axios';

/**
 * 组织机构树
 */
export const organTree = () => {
  return request({
    url: '/user/organ/organTree',
    method: 'get'
  })
}

/**
 * 组织机构列表
 * @param current
 * @param size
 * @param params
 */
export const getList = (current, size, params) => {
  return request({
    url: '/user/organ/page',
    method: 'POST',
    params: {
      ...params,
      current,
      size,
    }
  })
}

//唯一性校验
export const verifyUnique = (data) => request({
  url: '/user/organ/verifyUnique',
  method: 'post',
  params: data
})

/**
 * 组织机构新增
 * @param row
 */
export const add = (row) => {
  return request({
    url: '/user/organ/add',
    method: 'post',
    data: row
  })
}

/**
 * 组织机构更新
 * @param row
 */
export const update = (row) => {
  return request({
    url: '/user/organ/update',
    method: 'post',
    data: row
  })
}

/**
 * 组织机构删除
 * @param row
 */
export const remove = (row) => {
  return request({
    url: '/user/organ/remove',
    method: 'post',
    data: row
  })
}